home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-07-20 | 1.2 KB | 66 lines | [TEXT/CWIE] |
- //Copyright (c) 1997 Aidan Cully
- //All rights reserved
-
- #include "CLStyleBox.h"
- #include <Resources.h>
- #include "CLBaseWindow.h"
-
- TStyleBox::TStyleBox(
- TLayoutBranch *super,
- short resID
- ):
- TWindowDrawer( super ),
- mResID( resID )
- {
- mPos.h= 0;
- mPos.v= 0;
- mHeight= 0;
- }
-
- void TStyleBox::AttachedToWindow(
- TBaseWindow *win,
- Rect size
- )
- {
- TWindowDrawer::AttachedToWindow( win, size );
- ::InsetRect( &size, 2, 1 );
- mTE= TEStyleNew( &size, &size );
- HidePen();
- Handle tData;
- StScrpHandle sData;
- tData= ::GetResource( 'TEXT', mResID );
- sData= (StScrpHandle)::GetResource( 'styl', mResID );
- HLock( tData );
- TEStylInsert( (*tData), GetHandleSize( tData ), sData, mTE );
- HUnlock( tData );
- ReleaseResource( tData );
- ReleaseResource( (Handle)sData );
- mHeight= TEGetHeight( (**mTE).nLines, 0, mTE );
- (**mTE).inPort= win->GetWindow();
- ShowPen();
- }
-
- void TStyleBox::ScrollTo(
- short h,
- short v
- )
- {
- mWindow->GetDrawFocus();
- TEScroll( h-mPos.h, v-mPos.v, mTE );
- mWindow->ReleaseDrawFocus();
- mPos.h= h;
- mPos.v= v;
- }
-
- void TStyleBox::DrawWindowSelf(
- TBaseWindow *gr
- )
- {
- Rect foo= GetLocalRect();
- TEUpdate( &foo, mTE );
- }
-
- Rect TStyleBox::GetLargestSize()
- {
- return( mContentRect );
- }